<template>
	<div class="portal_add_container">
		<div class="button">
			<el-button class="cancel" size="small" @click="handleHeaderBack()">取消</el-button>
			<el-button class="confirm" size="small" type="primary" @click="handleSubmitForm()">确认</el-button>
		</div>
		<el-page-header @back="handleHeaderBack()" :content="`新增站点`"></el-page-header>
		<site-form ref="form" :data="portalData" :is-edit="true"></site-form>
	</div>
</template>

<script>
import { mapGetters } from 'vuex';
import siteMixins from './mixins';
export default {
	mixins: [siteMixins],
	data() {
		return {};
	},
	computed: { ...mapGetters(['dictConst', 'userInfo']) },
	async mounted() {
		let userData = { relId: this.userInfo.id, relName: this.userInfo.username };
		userData['picAttr'] = this.userInfo.picId === '-1' ? this.defaultImage : await this.getFileUrl(this.userInfo.picId);
		this.$set(this.portalData, 'template', this.dictConst['SITE_TEMPLATE']);
		this.$set(this.portalData, 'userList', [userData]);
	},
	methods: {
		//提交表单新增
		handleSubmitForm() {
			console.log('123123');
			this.$refs['form'].submitForm();
		}
	}
};
</script>

<style lang="scss" scoped>
.portal_add_container {
	display: flex;
	flex-direction: column;
	height: 100%;
	position: relative;
	overflow: hidden;

	.el-page-header {
		padding: 16px;
		border-bottom: solid 1px #EBEEF5;
	}

	.el-form {
		flex: 1;
		overflow: auto;
	}

	.button {
		position: absolute;
		top: 12px;
		right: 12px;
	}
}
</style>